package com.example.demo.proxy;

/**
 * Created with IntelliJ IDEA 2023.
 * Description:
 * User: homechen
 * Date: 2024-03-11
 * Time: 13:11
 */

/**
 * 代理类
 */
public class HouseProxy implements HouseSubject {
    // 将代理对象设置为成员变量
    private RealSubject realSubject;

    public HouseProxy(RealSubject realSubject) {
        this.realSubject = realSubject;
    }

    @Override
    public void rentHouse() {
        System.out.println("我是中介 - 开始代理！");
        realSubject.rentHouse();
        System.out.println("我是中介 - 代理结束！");
    }
}
